<div class="eleven columns">
    <ul class="breadcrumbs top">
        <li><a title="<?php echo $this->siteName?>" href="<?php echo $this->baseUrl?>"><span class="icon home gray"></span></a></li>
        <li><a title="<?php echo $this->siteName?>" href="<?php echo $this->baseUrl?>">Trang chủ</a><b>»</b></li>
        <li><a title="Xem Phim" href="<?php echo $this->createUrl('/movie/movie')?>">Phim</a><b>»</b></li>
        <li><?php echo $model->name?></li>
    </ul> 
</div>
<div class="five columns">
    <div class="search top">
        <form action="<?php echo $this->createUrl('/movie/movie/search')?>" method="post" class="fullwidth-search">
            <input name="q" type="text" placeholder="Tìm phim" class="search" <?php if($term = Yii::app()->request->getQuery('term')) echo 'value="'.$term.'"'?> style="padding: 11px 30px 11px 11px;">
            <input type="submit" class="submit-search" style="top: 14px" value="">
        </form>
    </div>
</div>

<div class="sixteen columns">
<h1 class="page-title"><?php echo $model->name?><span class="line"></span></h1>
</div>
  
<div class="one-third column bottom">
    <h4 class="title">Poster<span class="line"></span></h4>
    <img src="<?php echo $model->imageUrl?>"/>
</div>

<div class="one-third column bottom">

    <h4 class="title">Thông tin phim<span class="line"></span></h4>

    <ul class="check-list">
        <?php if($model->name_en):?><li>Tên tiếng anh: <a href="<?php echo $model->url?>"><?php echo $model->name_en?></a></li><?php endif?>

        <li>Đạo diễn: <?php echo $model->director ? $this->getStrSearchLinks($model->director, 'director') : 'Chưa rõ'?></li>
        <li>Diễn viên: <?php echo $model->actor ? $this->getStrSearchLinks($model->actor, 'actor') : 'Chưa rõ'?></li>
        <li>Thể loại: <?php echo $model->catLinks?></li>
        <li>Quốc gia: <a href="<?php echo $model->country->url?>"><?php echo $model->country->name?></a></li>
        <?php if($model->type == 'SHORT' && $model->timeline):?><li>Thời lượng: <?php echo $model->timeline?> Phút</li><?php endif?>
        <li>Năm phát hành: <a title="Danh sách phim năm <?php echo $model->year?>" href="<?php echo $this->createUrl('/movie/movie', array('year' => $model->year))?>"><?php echo $model->year?></a></li>
        <li>Lượt xem: <?php echo $model->view?></li>
    </ul><!-- End check-list -->

    <?php if(!$this->detect->isMobile()):?>
    <div class="lightbox gallery">
        <a class="button large color" href="<?php echo $model->trailer?>" rel="prettyPhoto[trailer]">
            <span class="play icon white"></span> Xem Trailer
        </a>
    </div>
    <?php endif?>

</div>

<div class="one-third column bottom">


    <h4 class="title">Xem Phim <span class="line"></span></h4>

    <ul class="sti-menu">
        <li class="play-movie">
            <a title="Xem phim <?php echo $model->name?>" href="#watch-movie" class="link_anchor" id-ref="play-movie">      
                <img style="margin-top: 20px;" src="<?php echo $this->themeUrl?>/files/css/images/play.png"/>
                <h1>Xem Phim</h1>
                <div> <?php echo $model->name?> HD Phụ đề tiếng việt </div>
            </a>
        </li>
    </ul>
</div>

<div class="clearfix"></div>

<?php if($this->detect->isMobile()):?>
<div class="sixteen columns">
    <h4 class="title">Trailer<span class="line"></span></h4>
    <div class="video-wrap widescreen">
        <iframe src="<?php echo $model->trailerIframe?>" frameborder="0" allowfullscreen></iframe>

    </div>
</div>
<?php endif?>

<div class="sixteen columns">
    <h4 class="title">Nội dung<span class="line"></span></h4>

    <blockquote class="top bottom-2"><?php echo $model->desc?></blockquote>

    <div id="movie-content">
        <?php echo $model->content?>
    </div>

</div>

<div class="sixteen columns" id="play-movie"> 
    <h2 class="title">Xem Phim <?php echo $model->name?><span class="line"></span></h2>
    <?php /*
            <video id="player" class="video-js vjs-default-skin" controls <?php if($selected['autostart'] =='true') echo 'autoplay'?> preload="auto" data-setup="{}">
              <source src="<?php echo $selected['url_redirect']?>" type='video/mp4'>
              <track kind="subtitles" src="<?php echo $this->baseUrl?>/subtitle.srt">
              <track kind="captions" src="<?php echo $this->baseUrl?>/subtitle.srt" srclang="en" label="English" default/>
              <p>Trình duyệt của bạn không hỗ trợ HTML5 Video. Hãy dùng Chrome phiên bản mới nhất.</p>
            </video>
    */?>
            
    <?php /*if($this->detect->isMobile()):?>
        <?php if(strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== FALSE):?>
            <p>Trình duyệt Firefox trên Mobile và Tablet không hỗ trợ xem phim. Bạn hãy chuyển sang Chrome hoặc Safari.</p>
        <?php else:?>
            <video id="player" class="video-js vjs-default-skin" <?php if($selected['autostart'] =='true') echo 'autoplay="autoplay"'?> controls preload="auto" data-setup="{}">
              <source src="<?php echo $selected['url_redirect']?>" type='video/mp4'>
              <p>Trình duyệt của bạn không hỗ trợ HTML5 Video. Hãy dùng Chrome phiên bản mới nhất.</p>
            </video>
        <?php endif?>

    <?php else: */?>
    
    <iframe width="560" height="315" src="http://www.youtube-nocookie.com/embed/p_4PFqqGWb0?rel=0" frameborder="0" allowfullscreen></iframe>
    
    <?php echo '<pre>';print_r($selected);echo '</pre>';?>
        <script type="text/javascript" src="<?php echo $this->baseUrl?>/files/jwplayer/5.9/jwplayer.js"></script>
        <div id="player">Movie Loading ...</div> 
        <script type="text/javascript"> 
            jwplayer("player").setup({ 
                    flashplayer: "<?php echo $this->baseUrl?>/files/jwplayer/5.9/player.swf", 
                    file: "<?php echo $selected['url_redirect']?>",
                    <?php if(!$this->detect->isMobile()):?>
                    height: 528, 
                    width: 940,
                    <?php endif?>
                    skin: "<?php echo $this->baseUrl?>/files/jwplayer/skins/NewTubeDark.zip",
                    autostart: <?php echo $selected['autostart']?>,
//                    plugins: {
//                         "captions": {
//                           file: "<?php echo $this->baseUrl?>/subtitle.srt",
//                         },
//                   },

            }); 
        </script>

    <?php //endif*/?>

</div><!-- Page Title -->

<div class="sixteen columns"> 
    <h2 class="title">Server Phim: <?php echo $selected['server']?> - Chất lượng <?php echo $selected['q_name']?><span class="line"></span></h2>
</div>
<div class="clearfix"></div>

    <?php
//    echo "<pre>";print_r($selected);echo "</pre>";
//    echo "<pre>";print_r($serverLinks);echo "</pre>";
     foreach($serverLinks as $server_alias => $server):?>
        <?php if($server['links']):?>
            <?php $link = current($server['links'])?>
                <div class="three columns">
                    <a class="button large movie-servers <?php echo ($server_alias == $selected['server_alias']) ? 'color' : 'black'?>" url="<?php echo $link['url_redirect']?>" href="<?php echo $link['url_web']?>"><?php echo $server['name']?></a>
                </div>
                <div class="thirteen columns top">
                    <?php foreach($link['url_web_qs'] as $q => $qUrl):?>
                <a class="button small movie-servers-q <?php echo ($server_alias == $selected['server_alias'] && $q == $selected['q']) ? 'color' : 'black'?>"<?php /* url="<?php echo $qUrl['url_redirect']?>"*/?> href="<?php echo $qUrl['url_web']?>">Chất lượng <?php echo $qUrl['name']?></a>
                <?php endforeach?>
                </div>
                <hr/>
            <?php endif?>
        <?php endforeach;?> 
        <blockquote class="top">
            <p>Bạn hãy chọn chất lượng phim phù hợp với đường truyền internet của bạn.</p>
            <p>Mạng 3G chọn Chất lượng Trung Bình. Mạng ADSL chọn Chất lượng Tốt. Mạng ADSL+ chọn Chất lượng HD</p>
        </blockquote>

<?php if($relatedMovies):?>
<div class="sixteen columns" id="play-movie"> 
    <h2 class="title">Phim cùng thể loại<span class="line"></span></h2>
</div>

<div class="recent-work gallery clearfix list">
    <?php foreach($relatedMovies as $movie):?>
        <?php $this->renderPartial('_view', array('data' => $movie));?> 
        <?php endforeach?>
</div>
<div class="clearfix"></div>
<?php endif?>